package com.kkb.dtg.config;

import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * 访问地址：http://localhost:8080/swagger-ui.html#
 * @Author 何世鹏
 * @Date 2021/2/19 20:18
 */
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                //扫描的路径
                .apis(RequestHandlerSelectors.basePackage("com.kkb.dtg"))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("文档名称")
                .description("文档介绍")
                .version("version 1.0")
                .build();
    }
}
